﻿using System;
using System.Runtime.Serialization;

namespace Dynamic.Data.Model.DataType
{
    [Serializable]
    [DataContract]
    public class Lookup : DynamicReference
    {
        public Lookup()
        {
        }

        public Lookup(string type, Guid value)
        {
            base.type = type;
            base.Value = value;
        }

        public override bool Equals(object obj)
        {
            Lookup lookup = obj as Lookup;
            return base.Value.Equals(lookup.Value);
        }

        public override int GetHashCode()
        {
            return base.Value.GetHashCode();
        }

        [DataMember]
        public static Lookup Null
        {
            get
            {
                return new Lookup { IsNull = true, IsNullSpecified = true };
            }
        }
    }
}
